const net = require('net')
// 进行了相关的创建
const server = net.createServer(socket => {
  console.log('socket connected')
  socket.on('close', () => console.log('socket disconnected'))
  socket.on('error', err => console.error(err.message))
  socket.on('data', data => {
    console.log(`receive: ${data}`)
    socket.write(data + '方杰小伙nishi子')
    // console.log(`send: ${data}`)
  })
})
server.listen(8888)